package inl.resilienceManager.qmul.gemom;

import java.awt.*;
import javax.swing.*;

/** COPYRIGHT DISCLAIMER
 * Synopsis: All the source codes presented in this document are intellectual
 * properties of Queen Mary, University of London.
 * 
 * @year 2010
 * @author Peng Jiang, John Bigham, Jiayi Wu Jinfu Wang------------QMUL
 * @version 1.0 
 * */

public class SplashScreen extends JWindow {
	
	 private int duration;
	    
	    public SplashScreen(int d) {
	        duration = d;
	        
	        showSplash();
	    }
	    
	    // A simple little method to show a title screen in the center
	    // of the screen for the amount of time given in the constructor
	    public void showSplash() {
	        
	        JPanel content = (JPanel)getContentPane();
	        
	        // Set the window's bounds, centering the window
	        int width = 510;
	        int height =284;
	        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
	        int x = (screen.width-width)/2;
	        int y = (screen.height-height)/2;
	        setBounds(x,y,width,height);
	        
	        // Build the splash screen
	        //JLabel label = new JLabel(new ImageIcon("C:\\\\Users\\pengj\\Documents\\gemom.gif"));
	        JLabel label = new JLabel(new ImageIcon("images\\gemom.gif"));
	        content.add(label, BorderLayout.CENTER);
	        
	        // add two button
	       
	        // Display it
	        setVisible(true);
	        
	        // Wait a little while, maybe while loading resources
	        try { Thread.sleep(duration); } catch (Exception e) {}
	        
	        setVisible(false);
	        
	    }

}
